package com.hkts.management.message.config;


import com.hkts.management.message.nettyhandler.NettyServer;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

/**
 * @ClassNameNettyServerRun
 * @Description   配置启动netty
 * @Author yck
 * @Date2021-04-25 9:27
 * @Version V1.0
 **/
@Component
@Order(1)
public class NettyServerRun implements ApplicationRunner {
    @Value("${netty.port}")
    private int port;
    @Override
    public void run(ApplicationArguments args) throws Exception {
        try {
            new NettyServer(port).start();
        }catch(Exception e) {
            System.out.println("NettyServerError:"+e.getMessage());
        }
    }
}
